package day10_io_code.com.itheima.d2_buffer_stream;

import java.io.*;

public class BufferedInputStreamDemo1 {
    public static void main(String[] args) {
        try (
                InputStream is = new FileInputStream("text.txt");
                InputStream bis = new BufferedInputStream(is);

                OutputStream os = new FileOutputStream("tex.txt");
                OutputStream bos = new BufferedOutputStream(os);
        ){
            byte[] buffer = new byte[1024];
            int len;
            while ((len = bis.read(buffer)) != -1) {
                bos.write(buffer, 0, len);
            }
        } catch (Exception e){
            e.printStackTrace();
        }
    }
}
